package cn.jdw.shop.product.controller;


import cn.jdw.shop.product.entity.Commodity;
import cn.jdw.shop.product.service.ICommodityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author ListJiang
 * @since 2021-09-29
 */
@RestController
@RequestMapping("/product/commodity")
public class CommodityController {
    @Autowired
    private ICommodityService iCommodityService;
    /**
     * @return 测试1
     */
    @RequestMapping("/test")
    public Commodity test() {
        return iCommodityService.list().get(0);
    }
    /**
     * @return 测试2
     */
    @RequestMapping("/test/{id}")
    public Commodity test(@PathVariable(value = "id") String id) {
        return iCommodityService.test(id);
    }

}